package com.integral.xr.module.platform.dal.mysql.pointsrule;

import java.util.*;

import com.integral.xr.framework.common.pojo.PageResult;
import com.integral.xr.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.integral.xr.framework.mybatis.core.mapper.BaseMapperX;
import com.integral.xr.module.platform.dal.dataobject.pointsrule.PointsRuleDO;
import org.apache.ibatis.annotations.Mapper;
import com.integral.xr.module.platform.controller.admin.pointsrule.vo.*;

/**
 * 积分规则 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PointsRuleMapper extends BaseMapperX<PointsRuleDO> {

    default PageResult<PointsRuleDO> selectPage(PointsRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PointsRuleDO>()
                .likeIfPresent(PointsRuleDO::getSort, reqVO.getSort())
                .likeIfPresent(PointsRuleDO::getName, reqVO.getName())
                .likeIfPresent(PointsRuleDO::getDetails, reqVO.getDetails())
                .eqIfPresent(PointsRuleDO::getPointsType, reqVO.getPointsType())
                .eqIfPresent(PointsRuleDO::getState, reqVO.getState())
                .orderByDesc(PointsRuleDO::getId));
    }

}